﻿using System;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using wnxd_feature;

namespace Hidistro.UI.Common.Controls
{
    public class wnxd_FeatureModify : WebControl
    {

        protected override void Render(HtmlTextWriter writer)
        {
            writer.Write(this.RendHtml());
        }

        public string RendHtml()
        {
            StringBuilder builder = new StringBuilder();
            string[] wnxd_feature = (new feature()).GetFeature(int.Parse((HttpContext.Current.Handler as System.Web.UI.Page).Request.QueryString["CategoryId"]));
            builder.Append("<div>");
            for (int n = 0; n < wnxd_feature.Length; n++)
            {
                if (!string.IsNullOrEmpty(wnxd_feature[n]))
                {
                    builder.AppendFormat("<div class=\"wnxd_feature_modify\" style=\"float:left;display:block;padding:2px;margin:1px;cursor:pointer;\" tag=\"{1}\">{0}<b style=\"visibility:hidden;\">×</b></div>", wnxd_feature[n], n + 1);
                }
            }
            builder.Append("<div class=\"wnxd_feature_add\" style=\"float:left;display:block;padding:2px;cursor:pointer;margin:1px;\"><b>＋</b>添加</div>");
            builder.Append("<div class=\"wnxd_feature_input\" style=\"float:left;display:none;padding:2px;cursor:pointer;margin:1px;\"><input type=\"text\" style=\"margin:1px;\"></div>");
            builder.Append("</div>");
            return builder.ToString();
        }
    }
}